#!/bin/bash
cd "."
## For rooted user: pulseaudio --start --system
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD

# 设置根目录为arch - arm64
folder="arch-arm64"

command="proot"
command+=" --link2symlink"
command+=" -0"
command+=" -r arch-arm64"  # 指定根目录为arch - arm64
command+=" -b /dev"
command+=" -b /proc"
command+=" -b arch-arm64/root:/dev/shm"  # 将arch - arm64内的root目录挂载到/dev/shm
## uncomment the following line to have access to the home directory of termux
#command+=" -b /data/data/com.termux/files/home:/root"
## uncomment the following line to mount /sdcard directly to /
#command+=" -b /sdcard"
command+=" -w /root"
command+=" /usr/bin/env -i"
command+=" HOME=/root"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=xterm-256color"
command+=" LANG=zh_CN.UTF-8"
command+=" /bin/bash --login"

# 检查是否有命令行参数
if [ -z "$1" ]; then
    exec $command
else
    com="$@"
    $command -c "$com"
fi
